package com.zjj.learn.designmodel.work.shareElement;

import java.util.HashMap;
import java.util.Map;

public class BoxFactory {

    private static Map<String ,AbstractBox> map;

    private BoxFactory(){
        map = new HashMap<>();
        AbstractBox iBox = new IBox();
        AbstractBox pBox = new PBox();
        AbstractBox oBox = new OBox();
        AbstractBox lBox = new LBox();
        map.put("I",iBox);
        map.put("P",pBox);
        map.put("O",oBox);
        map.put("L",lBox);
    }

     static {
        final BoxFactory INSTANCE= new BoxFactory();
    }

    public static AbstractBox getBox(String shape){
        return map.get(shape);
    }
}
